package com.scott.crm.teacher.service.impl;
import com.scott.base.message.DataUtil;
import com.scott.crm.clazz.bean.ClazzBean;
import com.scott.crm.clazz.bean.ClazzStudentTeacherBean;
import com.scott.crm.clazz.dao.ClazzDao;
import com.scott.crm.delay.bean.DelayBean;
import com.scott.crm.holiday.dao.HolidayDao;
import com.scott.crm.resume.dao.QuestionDao;
import com.scott.crm.role.bean.RoleBean;
import com.scott.crm.role.bean.UserRoleBean;
import com.scott.crm.role.dao.UserRoleDao;
import com.scott.crm.teacher.bean.TeacherBean;
import com.scott.crm.teacher.dao.TeacherDao;
import com.scott.crm.teacher.dto.MyDto;
import com.scott.crm.teacher.service.TeacherService;
import com.scott.crm.user.bean.UserBean;
import com.scott.crm.user.dao.UserDao;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * @author 袁海华
 * @date 2021/11/23 9:31
 */
@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherDao dao;
    @Autowired
    private UserDao userDao;
    @Autowired
    private ClazzDao clazzDao;
    @Autowired
    private HolidayDao holidayDao;
    @Autowired
    private QuestionDao questionDao;
    @Autowired
    private UserRoleDao userRoleDao;

//    @Override
//    public int findAllLateStudent(ClazzBean clazzBean) {
//
//        return dao.findAllLateStudent(clazzBean);
//    }


    @Override
    public Integer updateClazz(MyDto myDto) {
        return dao.updateClazz(myDto);
    }

    @Override
    public int deleteAssignClazz(List<Integer> ids) {
        return dao.deleteAssignClazz(ids);
    }

    @Override
    public Integer updateTeacherByUserId(TeacherBean  teacherBean) {


        return dao.updateTeacherByUserId(teacherBean);
    }

    @Override
    public List<UserRoleBean> findAll(@Param("begin") Integer begin, @Param("end") Integer end) {
        return null;
    }
//    @Autowired
//    private ClazzStudentTeacherDao clazzStudentTeacherDao;
    @Override
    public List<MyDto> findTeacherInforByClazzType() {
        return dao.findTeacherInforByClazzType();
    }

    @Override
    public List<TeacherBean> findAllTeacher() {
        return dao.findAllTeacher();
    }

    @Override
    public List<TeacherBean> findAllTeacherPage(Integer begin, Integer end) {
        return dao.findAllTeacherPage(begin,end);
    }


    //    @Override
//    public List<UserBean> findStudentOrTeacherByNotClass(RoleBean roleBean) {
//        return userDao.findStudentOrTeacherByNotClass(roleBean);
//    }
    @Override
    public int add(TeacherBean teacherBean) {
        return dao.insert(teacherBean);
    }
    @Override
    public int deleteById(List<Integer> ids) {
        return dao.deleteById(ids);
    }

    @Override
    public int update(TeacherBean teacherBean) {
        return dao.updateByPrimaryKey(teacherBean);
    }
    @Override
    public int updateTeacherInforByTeacherId(UserBean userBean) {
        return userDao.updateByPrimaryKey(userBean);
    }
    @Override
    public List<Integer> findAllTeacherIdByRoleId(Integer roleId) {
        return dao.findAllTeacherIdByRoleId(roleId);
    }
    @Override
    public int addClazzByTeacherId(ClazzStudentTeacherBean clazzStudentTeacherBean) {
       return dao.addClazzByTeacherId(clazzStudentTeacherBean);
    }
    @Override
    public TeacherBean findById(Integer teacherId) {
        TeacherBean teacherBean= new TeacherBean();
        teacherBean.setTeacherId(teacherId);
        return dao.selectOne(teacherBean);
    }
    @Override
    public List<DelayBean> findLateStudentInforByTeacherId(Integer teacherId) {
        return dao.findLateStudentInforByTeacherId(teacherId);
    }
    @Override
    public List<Integer> findStudentIdByTeacherId(Integer teacherId) {
        Integer classId = dao.findClazzIdByTeacherId(teacherId);
        return dao.findALLStudentIdByClazzId(classId);
    }

//    @Override
//    public ArrayList<QuestionEntity> findQuestionsByTeacherId(Integer teacherId) {
//        Integer clazzIdByTeacherId = dao.findClazzIdByTeacherId(teacherId);
//        return questionDao.selectQuestionEntityByClassId(clazzIdByTeacherId);
//    }

}



